package org.zjt.clone;


import java.util.*;

/**
 * Description:
 *
 * @author juntao.zhang
 * Date: 2018-06-05 上午10:43
 * @see
 */
public class CloneTest {


    public static void main(String[] args) throws CloneNotSupportedException {

        Team team = Team.builder().NO("11122").userList(Arrays.asList(new User("zhangsan",23))).build();

        // clone 实现深拷贝，对象属性的深入拷贝。
        Object clone = team.clone();

        // 重写equals 和 hash 方法
        System.out.println(clone);
        System.out.println(Objects.equals(clone, team));
        System.out.println(Objects.equals(clone.hashCode(), team.hashCode()));


        // list -> [1,2,3] 等
        System.out.println(Arrays.asList("222","33"));
        LinkedList<String> strings = new LinkedList<>(Arrays.asList("222", "33"));
        System.out.println(strings);
        strings = new LinkedList<>();
        strings.add("333");
        strings.add("444");
        System.out.println(strings);

        // map -> {444=21, 3333=23}
        Map <String,Integer> map = new HashMap<>();
        map.put("3333",23);
        map.put("444",21);
        System.out.println(map.toString());


        // set -> [1,2,3] 等
        System.out.println(map.keySet());
    }

}
